import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '@/views/HomeView.vue';

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home',
    },
    // 重定向到首页的通配路由
    {
      path: '/:pathMatch(.*)*',
      redirect: '/',
    },
    {
      path: '/home',
      name: 'HomeView', //首页
      component: HomeView,
    },
    {
      path: '/elementPagenationDemo',
      name: 'ElementPagenationDemo', //分页demo
      component: () => import('@/views/ElementPagenationDemo.vue'),
    },
  ],
});

export default router;
